package cn.tedu.pojo;

import cn.tedu.service.DeptMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

public class DeptDdl {
    @Test
    public void Ddl() throws IOException {
        InputStream in = Resources.getResourceAsStream("mybatis-config.xml");

        SqlSessionFactory session = new SqlSessionFactoryBuilder().build(in);
        SqlSession sqlSession = session.openSession();
        DeptMapper mapper = sqlSession.getMapper(DeptMapper.class);
        mapper.deleteFromDeptById(new int[]{1,2,3});
        sqlSession.commit();
    }
}
